
import 'dart:io';

import 'package:valovault_reminder/common/config/val_assets_name.dart';
import 'package:flutter/material.dart';

class ValNoticeListBodyCell extends StatefulWidget {
  final String title;
  final String content;
  final String subTime;

  final Function()? onTap;
  final Function()? onTapConfig;
  final Function()? onTapDelete;

  const ValNoticeListBodyCell({super.key, this.onTap, this.title = '',
    this.content = '', this.subTime = '', this.onTapDelete, this.onTapConfig});

  @override
  State<ValNoticeListBodyCell> createState() => _ValNoticeListBodyCellState();
}

class _ValNoticeListBodyCellState extends State<ValNoticeListBodyCell> {

  @override
  Widget build(BuildContext context) {
    return GestureDetector(
      onTap: widget.onTap,
      child: Container(
        height: 72,
        margin: const EdgeInsets.only(left: 20, right: 20, bottom: 16),
        child: Container(
            // margin: const EdgeInsets.only(left: 30, right: 30, top: 12, bottom: 12),
            decoration: const BoxDecoration(
              // color: Colors.blue,
              image: DecorationImage(
                  image: AssetImage('${ValAssetsName.ASSETS_Message}val_notice_item_ground.png'),
                  fit: BoxFit.fill),
            ),
            child: Row(
              children: [
                Expanded(
                  child: Container(
                    height: 72,
                    // margin: const EdgeInsets.only(left: 22, right: 16, top: 9, bottom: 8),
                    // decoration: const BoxDecoration(
                    //   // color: Colors.blue,
                    //   image: DecorationImage(
                    //       image: AssetImage('${CsConfig.ASSETS_Message}val_notice_list_left_ground.png'),
                    //       fit: BoxFit.fill),
                    // ),
                    child: Container(
                      margin: const EdgeInsets.only(left: 30),
                      child: Column(
                        crossAxisAlignment: CrossAxisAlignment.start,
                        mainAxisAlignment: MainAxisAlignment.center,
                        children: [
                          Container(
                            height: 20,
                            child: Text(widget.title,
                              style: const TextStyle(color: Colors.black, fontSize: 18, fontWeight: FontWeight.w500), overflow: TextOverflow.clip,),
                          ),
                          Container(
                            height: 18,
                            alignment: Alignment.centerLeft,
                            child: Text(widget.content,
                              style: const TextStyle(color: Color(0xFF666666), fontSize: 12), overflow: TextOverflow.clip,),
                          ),
                          const Padding(padding: EdgeInsets.only(top: 6)),
                        ],
                      ),
                    ),
                  ),
                ),
                GestureDetector(
                  onTap: widget.onTapConfig,
                  child: Container(
                    height: 72,
                    width: 104,
                    decoration: const BoxDecoration(
                      // borderRadius: BorderRadius.circular(20),
                      color: Colors.transparent,
                      // image: DecorationImage(
                      //     image: AssetImage('${CsConfig.ASSETS_Message}val_notice_list_right_ground.png'),
                      //     fit: BoxFit.fill),
                    ),
                    child: Column(
                      mainAxisAlignment: MainAxisAlignment.start,
                      crossAxisAlignment: CrossAxisAlignment.end,
                      children: [
                        Container(
                          margin: const EdgeInsets.only(top: 2),
                          child: GestureDetector(
                            onTap: widget.onTapDelete,
                            child: Image.asset('${ValAssetsName.ASSETS_Message}val_notice_list_close_icon.png', width: 20, height: 15,),
                          ),
                        ),
                        Container(
                          margin: const EdgeInsets.only(right: 20),
                          child: Text(widget.subTime,
                            style: const TextStyle(color: Color(0xFF333333), fontSize: 12), overflow: TextOverflow.clip,),
                        ),
                        const Padding(padding: EdgeInsets.only(top: 2)),
                        Container(
                          margin: const EdgeInsets.only(right: 26),
                          child: Image.asset('${ValAssetsName.ASSETS_Message}val_notice_list_voice_icon.png', width: 32, height: 32,),
                        ),
                      ],
                    ),
                  ),
                ),
              ],
            )
        ),

      ),
    );
  }
}
